package Cantella::DJabberd::Web::Controller::Admin::Role;

#the order the following IS RELEVANT
use base 'Cantella::DJabberd::Web::UI::Controller::Collection::CRUD';
use Reaction::Class;

__PACKAGE__->config
  (
   model_name => 'Admin',
   collection_name => 'roles',
   action =>
   { base => { Chained => '/admin/base', PathPart => 'role' },
     create => { ViewPort => {field_order => [qw(name description users)],},},
     update => { ViewPort => {field_order => [qw/name description users/],},},
     list   => { ViewPort => {
                              excluded_fields => [qw/id/],
                              field_order    => [qw/name description/], 
                             }, 
               },
     view   =>
     { ViewPort =>
       {
        field_order    => [qw/name description users/],
        excluded_fields => [qw/id/],
        Field => { users => { controller => 'Admin::User' },},
       },
     },
   },
  );

sub base :Action :CaptureArgs(0) {
  my ($self, $c) = @_;
  $c->stash->{submenu}->current_item('roles');
}

1;
